From b7a2d3eb8ca79bb13a8dd775fa206dc40482a804 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 24 Mar 2005 11:04:24 +0000 Subject: [PATCH] bitkeeper revision 1.1236.1.124 (42429eb8uGingMvF7MF3Py6CUzFBzA) NMI watchdog hooks off ac_timer softirq rather than apic timer irq. In extreme situations we may service ac_timer events without ever actually taking an apic interrupt. Signed-off-by: Keir Fraser --- xen/arch/x86/apic.c | 5 ----- xen/arch/x86/nmi.c | 2 +- xen/common/ac_timer.c | 17 +++++++---------- xen/include/asm-x86/apic.h | 5 ----- xen/include/xen/ac_timer.h | 8 ++++++++ 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c index aa8907e0ba..49b51ba012 100644 --- a/xen/arch/x86/apic.c +++ b/xen/arch/x86/apic.c @@ -722,15 +722,10 @@ int reprogram_ac_timer(s_time_t timeout) return 1; } -unsigned int apic_timer_irqs [NR_CPUS]; - void smp_apic_timer_interrupt(struct xen_regs * regs) { ack_APIC_irq(); - - apic_timer_irqs[smp_processor_id()]++; perfc_incrc(apic_timer); - raise_softirq(AC_TIMER_SOFTIRQ); } diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c index 0fa5968be4..89770b774a 100644 --- a/xen/arch/x86/nmi.c +++ b/xen/arch/x86/nmi.c @@ -271,7 +271,7 @@ void nmi_watchdog_tick (struct xen_regs * regs) { int sum, cpu = smp_processor_id(); - sum = apic_timer_irqs[cpu]; + sum = ac_timers[cpu].softirqs; if ( (last_irq_sums[cpu] == sum) && watchdog_on ) { diff --git a/xen/common/ac_timer.c b/xen/common/ac_timer.c index 1f27ed7b08..4ffd4061fb 100644 --- a/xen/common/ac_timer.c +++ b/xen/common/ac_timer.c @@ -34,14 +34,7 @@ #define DEFAULT_HEAP_LIMIT 127 -/* A timer list per CPU */ -typedef struct ac_timers_st -{ - spinlock_t lock; - struct ac_timer **heap; -} __cacheline_aligned ac_timers_t; -static ac_timers_t ac_timers[NR_CPUS]; - +struct ac_timers ac_timers[NR_CPUS]; /**************************************************************************** * HEAP OPERATIONS. @@ -214,6 +207,8 @@ static void ac_timer_softirq_action(void) s_time_t now; void (*fn)(unsigned long); + ac_timers[cpu].softirqs++; + spin_lock_irq(&ac_timers[cpu].lock); do { @@ -277,8 +272,10 @@ void __init ac_timer_init(void) for ( i = 0; i < smp_num_cpus; i++ ) { - ac_timers[i].heap = xmalloc_array(struct ac_timer *, DEFAULT_HEAP_LIMIT+1); - if ( ac_timers[i].heap == NULL ) BUG(); + ac_timers[i].heap = xmalloc_array( + struct ac_timer *, DEFAULT_HEAP_LIMIT+1); + BUG_ON(ac_timers[i].heap == NULL); + SET_HEAP_SIZE(ac_timers[i].heap, 0); SET_HEAP_LIMIT(ac_timers[i].heap, DEFAULT_HEAP_LIMIT); spin_lock_init(&ac_timers[i].lock); diff --git a/xen/include/asm-x86/apic.h b/xen/include/asm-x86/apic.h index 54289910ab..403664ca37 100644 --- a/xen/include/asm-x86/apic.h +++ b/xen/include/asm-x86/apic.h @@ -83,12 +83,7 @@ extern int APIC_init_uniprocessor (void); extern void disable_APIC_timer(void); extern void enable_APIC_timer(void); -/*extern struct pm_dev *apic_pm_register(pm_dev_t, unsigned long, pm_callback);*/ -/*extern void apic_pm_unregister(struct pm_dev*);*/ - extern unsigned int watchdog_on; - -extern unsigned int apic_timer_irqs [NR_CPUS]; extern int check_nmi_watchdog (void); extern unsigned int nmi_watchdog; diff --git a/xen/include/xen/ac_timer.h b/xen/include/xen/ac_timer.h index 16e012ca10..4f3cf9de9c 100644 --- a/xen/include/xen/ac_timer.h +++ b/xen/include/xen/ac_timer.h @@ -19,6 +19,7 @@ #ifndef _AC_TIMER_H_ #define _AC_TIMER_H_ +#include #include struct ac_timer { @@ -87,6 +88,13 @@ extern void mod_ac_timer(struct ac_timer *timer, s_time_t new_time); extern int reprogram_ac_timer(s_time_t timeout); +struct ac_timers { + spinlock_t lock; + struct ac_timer **heap; + unsigned int softirqs; +} __cacheline_aligned; +extern struct ac_timers ac_timers[]; + #endif /* _AC_TIMER_H_ */ /* -- 2.30.2